package com.sxj.corejava.code03_分支结构;

/**
 * @author 石小俊
 * 2024年07月09日 14:07
 */
public class Test08_switch {

    public static void main(String[] args) {
        int num =2;
        switch (num) {
            case 1:
                System.out.println("num的值为1");
                break;
            case 2:
                System.out.println("num的值为2");
                break;
            case 3:
                System.out.println("num的值为3");
                break;
            case 4:
                System.out.println("num的值为4");
                break;
            case 5:
                System.out.println("num的值为5");
                break;
            default:
                System.out.println("上述的值均不对");
                break;
        }
        if(num == 1){
            System.out.println("num的值为1");
        } else if(num == 2){
            System.out.println("num的值为2");
        } else if(num == 3){
            System.out.println("num的值为3");
        } else if(num == 4){
            System.out.println("num的值为4");
        } else if(num == 5){
            System.out.println("num的值为5");
        } else{
            System.out.println("上述的值均不对");
        }
    }

}
